﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SX_MesProject
{
    public class ApiResult<T>
    {
        public int Code { get; set; }
        public string Message { get; set; }
        public T Data { get; set; }

        public ApiResult(int code, string message, T data)
        {
            Code = code;
            Message = message;
            Data = data;
        }

        public static ApiResult<T> Success(T data)
        {
            return new ApiResult<T>(200, "success", data);
        }

        public static ApiResult<T> Error(string message)
        {
            return new ApiResult<T>(500, message, default!);
        }
    }
}
